package splash.core.security;

import java.io.FileNotFoundException;

public class Users
{
	private final String USER_FILE = "users.xml";
	private UserList list;
	
	public Users()
	{
		try
		{
			list = UserLoader.loadUsers(USER_FILE);
		}
		catch(FileNotFoundException e)
		{
			//file not found handling
			e.printStackTrace();
		}
		catch(CorruptedFileException e)
		{
			//corrupted file handling
			//load defaults?
			e.printStackTrace();
		}
	}
	
	public UserList getUserList()
	{
		return this.list;
	}
	
	public boolean reloadList()
	{
		try
		{
			list = UserLoader.loadUsers(USER_FILE);
			return true;
		}
		catch(FileNotFoundException e)
		{
			//file not found handling
			return false;
		}
		catch(CorruptedFileException e)
		{
			//corrupted file handling
			return false;
		}
	}
}